﻿using FDStudio.Core.Entities;
using FDStudio.Core.Entities.Query;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;

namespace FDStudio.Core.Services
{
    /*
     CreatedOn: 2018-01-30
     CreatedBy: Jackie Lee(天宇遊龍)
     */
    /// <summary>
    /// 服务接口
    /// </summary>
    public interface IService<T> : IReadOnlyService<T>, IWriteOnlyService<T> where T : class, IEntity
    {
        /// <summary>
        /// 捕获性执行
        /// </summary>
        /// <param name="action">执行的业务</param>
        /// <param name="exceptionAction">异常动作</param>
        /// <param name="finishAction">结束操作</param>
        /// <returns></returns>
        IApiResult<R> Execute<R>(Func<IApiResult<R>> action, Action<Exception> exceptionAction = null, Action finishAction = null);

    }

    //public interface IService<T> : IService where T : class, IEntity
    //{
    //    bool Add(T model);

    //    bool Update(T model);

    //    T Get(long id);

    //    T Get(Expression<Func<T, bool>> condition);

    //    IEnumerable<T> GetList(Expression<Func<T, bool>> condition, IQueryOrder<T> orderBy = null);

    //    /// <summary>
    //    /// 进行分页操作
    //    /// </summary>
    //    /// <typeparam name="T"></typeparam>
    //    /// <param name="condition"></param>
    //    /// <param name="pagingAction">传入查询字符串，根据所需处理并返回结果查询字符串</param>
    //    /// <param name="orderBy"></param>
    //    /// <returns></returns>
    //    PagedList<T> GetList(Expression<Func<T, bool>> condition, long pageIndex, long pageSize, IQueryOrder<T> orderBy = null);

    //    bool Delete(T model);

    //    bool Delete(long id);

    //    bool Delete(Expression<Func<T, bool>> condition);

    //}

    /// <summary>
    /// 服务接口
    /// </summary>
    public interface IService
    {

    }
}
